package com.cencat.service.Impl;

import com.cencat.domain.Cat;
import com.cencat.mapper.CatMapper;
import com.cencat.service.CatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CatServiceImpl implements CatService {

    //注入
    @Autowired
    private CatMapper catMapper;
    @Override
    public List<Cat> getCatList() {
        return catMapper.findAll();
    }

    @Override
    public void save(Cat cat) {
        catMapper.save(cat);

    }

    @Override
    public void update(Cat cat) {
        catMapper.update(cat);

    }

    @Override
    public void delete(int id) {
        catMapper.delete(id);

    }

    @Override
    public Cat getCatById(int id) {
        return catMapper.findById(id);
    }

    @Override
    public List<Cat> getCatByPage(int page, int size) {
        return catMapper.getCatByPage(page,size);
    }
}
